import Vue from 'vue'
import VueRouter from 'vue-router'

import news from '@/views/news'
import my from '@/views/my'
import house from '@/views/house'
import index from '@/views/index'

import login from '@/views/login'
import layout from '@/views/layout'
import register from '@/views/register'

Vue.use(VueRouter)

const routes = [
  {
    path: '/login',
    component: login
  },
  {
    path: '/register',
    component: register
  },
  {
    path: '/',
    component: layout,
    // 二级路由
    children: [
      {
        path: '/house',
        component: house
      },
      {
        path: '/news',
        component: news
      },
      {
        path: '/index',
        component: index
      },
      {
        path: '/my',
        component: my
      }

    ]
  }

]

const router = new VueRouter({
  routes
})

export default router
